// EBASAppDoc.cpp : implementation of the CEBASAppDoc class
//

#include "stdafx.h"
#include "EBASApp.h"

#include "EBASAppDoc.h"
#include "CntrItem.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CEBASAppDoc

IMPLEMENT_DYNCREATE(CEBASAppDoc, COleDocument)

BEGIN_MESSAGE_MAP(CEBASAppDoc, COleDocument)
	//{{AFX_MSG_MAP(CEBASAppDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//    DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_MSG_MAP
	// Enable default OLE container implementation
	ON_UPDATE_COMMAND_UI(ID_EDIT_PASTE, COleDocument::OnUpdatePasteMenu)
	ON_UPDATE_COMMAND_UI(ID_EDIT_PASTE_LINK, COleDocument::OnUpdatePasteLinkMenu)
	ON_UPDATE_COMMAND_UI(ID_OLE_EDIT_CONVERT, COleDocument::OnUpdateObjectVerbMenu)
	ON_COMMAND(ID_OLE_EDIT_CONVERT, COleDocument::OnEditConvert)
	ON_UPDATE_COMMAND_UI(ID_OLE_EDIT_LINKS, COleDocument::OnUpdateEditLinksMenu)
	ON_COMMAND(ID_OLE_EDIT_LINKS, COleDocument::OnEditLinks)
	ON_UPDATE_COMMAND_UI_RANGE(ID_OLE_VERB_FIRST, ID_OLE_VERB_LAST, COleDocument::OnUpdateObjectVerbMenu)
END_MESSAGE_MAP()

BEGIN_DISPATCH_MAP(CEBASAppDoc, COleDocument)
	//{{AFX_DISPATCH_MAP(CEBASAppDoc)
		// NOTE - the ClassWizard will add and remove mapping macros here.
		//      DO NOT EDIT what you see in these blocks of generated code!
	//}}AFX_DISPATCH_MAP
END_DISPATCH_MAP()

// Note: we add support for IID_IEBASApp to support typesafe binding
//  from VBA.  This IID must match the GUID that is attached to the 
//  dispinterface in the .ODL file.

// {108F5D47-8090-4665-8743-5A7EBDB2F129}
static const IID IID_IEBASApp =
{ 0x108f5d47, 0x8090, 0x4665, { 0x87, 0x43, 0x5a, 0x7e, 0xbd, 0xb2, 0xf1, 0x29 } };

BEGIN_INTERFACE_MAP(CEBASAppDoc, COleDocument)
	INTERFACE_PART(CEBASAppDoc, IID_IEBASApp, Dispatch)
END_INTERFACE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CEBASAppDoc construction/destruction

CEBASAppDoc::CEBASAppDoc()
{
	// Use OLE compound files
	EnableCompoundFile();

	// TODO: add one-time construction code here

	EnableAutomation();

	AfxOleLockApp();
}

CEBASAppDoc::~CEBASAppDoc()
{
	AfxOleUnlockApp();
}

BOOL CEBASAppDoc::OnNewDocument()
{
	if (!COleDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CEBASAppDoc serialization

void CEBASAppDoc::Serialize(CArchive& ar)
{
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}

	// Calling the base class COleDocument enables serialization
	//  of the container document's COleClientItem objects.
	COleDocument::Serialize(ar);
}

/////////////////////////////////////////////////////////////////////////////
// CEBASAppDoc diagnostics

#ifdef _DEBUG
void CEBASAppDoc::AssertValid() const
{
	COleDocument::AssertValid();
}

void CEBASAppDoc::Dump(CDumpContext& dc) const
{
	COleDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CEBASAppDoc commands

void CEBASAppDoc::SetTitle(LPCTSTR lpszTitle)
{
	CDocument::SetTitle(lpszTitle);
}
